﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JSON;

namespace Facebook_Graph_Toolkit.FacebookObjects {
    /// <summary>
    /// Represents a review of an Application on Facebook
    /// </summary>
    public class AppReview : GraphApi.GraphApiObject{
        internal AppReview(JsonObject JO) : base(JO) { }

        /// <summary>
        /// ID of Review. Apprently useless.
        /// </summary>
        public string ID { get { return (string)data["id"]; } }
        /// <summary>
        /// Message left by reviewer
        /// </summary>
        public string Message { get { return (string)data["message"]; } }
        /// <summary>
        /// A number from 1 to 5 inclusive that represents the user's rating on this application, with 1 being the worst and 5 being the best.
        /// </summary>
        public int Rating { get { return (int)data["rating"]; } }
        /// <summary>
        /// The user who made this review
        /// </summary>
        public NameIDPair Reviewer { get { return new NameIDPair((JsonObject)data["from"]); } }
        /// <summary>
        /// The Application that is being reviewed
        /// </summary>
        public NameIDPair Application { get { return new NameIDPair((JsonObject)data["to"]); } }
        /// <summary>
        /// The time which this review was made
        /// </summary>
        public DateTime CreatedTime { get { return Helpers.Common.RFC3339ToDateTime((string)data["created_time"]); } }
    }
}
